<%@ page language="java" import="java.util.*,com.orderMgr.bean.*"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'userOrderFood.jsp' starting page</title>

		<script type="text/javascript">
function del(id) {
	if (window.confirm("确实要删除吗？")) {
		location.href = "delOrdered.action?detailId=" + id;
	}
}
</script>

	</head>

	<body bgcolor="#FAFBE7">
		<center>
			
			<table border="1" bordercolor="#F6E5D5">
				<tr>
					<td>
						菜馆名称
					</td>
					<td>
						菜名
					</td>
					<td>
						姓名
					</td>
					<td>
						价格
					</td>
					<td>
						订餐电话
					</td>
					<td>
						订餐时间
					</td>
					<td>
						是否取消
					</td>
				</tr>
				<%
					List<UserOrderFood> list = (List<UserOrderFood>) request
							.getAttribute("showOrdered");
					int total = 0;
					for (int i = 0; i < list.size(); i++) {
						UserOrderFood uo = list.get(i);
						total += uo.getOfFoodPrice();
				%>
				<tr>
					<td><%=uo.getOfRestaurantName()%></td>
					<td><%=uo.getOfFoodName()%></td>
					<td><%=uo.getOfUserName()%></td>
					<td><%=uo.getOfFoodPrice()%></td>
					<td><%=uo.getOfTel()%></td>
					<td>
						<fmt:formatDate value="<%=uo.getOfTime()%>"
							pattern="yyyy-MM-dd HH:mm:ss" />
					</td>
					<%
						Long detailUserId = uo.getOfUserId(); //订餐用户ID
							Long userId = Long.parseLong(session.getAttribute("userId")
									.toString()); //当前用户ID
					%>
					<td>
						 <%
 						if (detailUserId.equals(userId)) {
 						%>
 
		<a href="javascript:del(<%=uo.getOfId()%>);">删除</a>
		 	<%
		 	} else {
			 %>
								别人的<%
							}
						%>
					</td>
				</tr>
				<%
					}
				%>
				<tr>
					<td colspan="7">
						<h3 style="font-weight: bold">
							总计：￥<%=total%></h3>
					</td>
				</tr>
				

			</table>
		</center>
	</body>
</html>
